/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.cncqs.backend.employee.entity;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.modules.sys.entity.Employee;
import com.jeesite.modules.sys.entity.Office;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

import java.util.Date;

/**
 * com_employeeEntity
 * @author cxy
 * @version 2019-04-23
 */
@Table(name="com_employee", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="company_id", attrName="companyId", label="所属公司id"),
		@Column(name="company_name", attrName="companyName", label="所属公司名称"),
		@Column(name="name", attrName="name", label="姓名", queryType=QueryType.LIKE),
		@Column(name="sex", attrName="sex", label="性别，0男，1女"),
		@Column(name="age", attrName="age", label="年龄"),
		@Column(name="id_num", attrName="idNum", label="身份证号码"),
		@Column(name="tel", attrName="tel", label="联系电话"),
		@Column(name="duty", attrName="duty", label="职务"),
		@Column(name="access_permission", attrName="accessPermission", label="是否可进入专间，0可以，1不可以"),
		@Column(name="employee_photo", attrName="employeePhoto", label="人脸图片地址"),
		@Column(name="is_manager", attrName="isManager", label="是否是管理员0不是，1是"),
		@Column(name="health_num", attrName="healthNum", label="健康证编号"),
		@Column(name="health_type", attrName="healthType", label="健康证类别"),
		@Column(name="health_picture", attrName="healthPicture", label="健康证图片"),
		@Column(name="create_date", attrName="createDate", label="create_date", isUpdate=false, isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="update_date", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注", queryType=QueryType.LIKE),
		@Column(name="ref_code", attrName="refCode", label="机构编号"),
		@Column(name="ref_name", attrName="refName", label="机构名称"),
		@Column(name="entry_date", attrName="entryDate", label="入职日期"),
		@Column(name="health_start", attrName="healthStart", label="健康证开始日期"),
		@Column(name="health_end", attrName="healthEnd", label="健康证结束日期"),
		@Column(name="train_date", attrName="trainDate", label="入职日期"),
		@Column(name="must_health", attrName="mustHealth", label="健康证是否比传"),
	},
		joinTable = {        @JoinTable(
				type = JoinTable.Type.JOIN,
				entity = Employee.class,
				alias = "e",
				on = "e.emp_code=a.ref_code",
				attrName = "employee",
				columns = {                @Column(
						includeEntity = Employee.class
				)}
		),  @JoinTable(
		type = JoinTable.Type.LEFT_JOIN,
		entity = Office.class,
		alias = "o",
		on = "o.office_code=e.office_code",
		attrName = "employee.office",
		columns = {                @Column(
				name = "office_code",
				label = "机构编码",
				isPK = true
		),                 @Column(
				name = "parent_codes",
				label = "所有父级编码",
				queryType = QueryType.LIKE
		),                 @Column(
				name = "view_code",
				label = "机构代码"
		),                 @Column(
				name = "office_name",
				label = "机构名称",
				isQuery = false
		),                 @Column(
				name = "full_name",
				label = "机构全称"
		),                 @Column(
				name = "office_type",
				label = "机构类型"
		),                 @Column(
				name = "leader",
				label = "负责人"
		),                 @Column(
				name = "phone",
				label = "电话"
		),                 @Column(
				name = "address",
				label = "联系地址"
		),                 @Column(
				name = "zip_code",
				label = "邮政编码"
		),                 @Column(
				name = "email",
				label = "邮箱"
		)}
),             },
		extWhereKeys = "dsfOffice", orderBy="a.update_date DESC"
)
public class ComEmployee extends DataEntity<ComEmployee> {
	
	private static final long serialVersionUID = 1L;
	private Long companyId;		// 所属门店id
	private String companyName; //所属门店名称
	private String name;		// 姓名
	private Integer sex;		// 性别，0男，1女
	private String idNum;		// 身份证号码
	private String tel;		// 联系电话
	private String duty;		// 职务
	private Integer accessPermission;		// 是否可进入专间，0可以，1不可以
	private String employeePhoto;		// 人脸图片地址
	private Integer isManager;		// 是否是管理员0不是，1是
	private String healthNum;		// 健康证编号
	private String healthType;		//健康证类别
	private String refCode;
	private String refName;
	private Object refObj;
	private Integer age;
	@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
	private Date entryDate;
	private Date healthStart;
	private Date healthEnd;
	private String organization;
	private Integer mustHealth;

	public Integer getMustHealth() {
		return mustHealth;
	}

	public void setMustHealth(Integer mustHealth) {
		this.mustHealth = mustHealth;
	}

	private Date trainDate;
	public Date getTrainDate() {
		return trainDate;
	}

	public void setTrainDate(Date trainDate) {
		this.trainDate = trainDate;
	}

	public String getOrganization() {
		return organization;
	}

	public void setOrganization(String organization) {
		this.organization = organization;
	}

	public Date getEntryDate() {
		return entryDate;
	}

	public void setEntryDate(Date entryDate) {
		this.entryDate = entryDate;
	}

	public Date getHealthStart() {
		return healthStart;
	}

	public void setHealthStart(Date healthStart) {
		this.healthStart = healthStart;
	}

	public Date getHealthEnd() {
		return healthEnd;
	}

	public void setHealthEnd(Date healthEnd) {
		this.healthEnd = healthEnd;
	}

	public Integer getAge() {
		return age;
	}

	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Object getRefObj() {
		return refObj;
	}

	public void setRefObj(Object refObj) {
		this.refObj = refObj;
	}

	public String getRefCode() {
		return refCode;
	}

	public void setRefCode(String refCode) {
		this.refCode = refCode;
	}

	public String getRefName() {
		return refName;
	}

	public void setRefName(String refName) {
		this.refName = refName;
	}

	public ComEmployee() {
		this(null);
	}

	public ComEmployee(String id){
		super(id);
	}
	

	@NotBlank(message="姓名不能为空")
	@Length(min=0, max=255, message="姓名长度不能超过 255 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@NotNull(message="性别，0男，1女不能为空")
	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}
	
	@NotBlank(message="身份证号码不能为空")
	@Length(min=0, max=255, message="身份证号码长度不能超过 255 个字符")
	public String getIdNum() {
		return idNum;
	}

	public void setIdNum(String idNum) {
		this.idNum = idNum;
	}
	
	@Length(min=0, max=255, message="联系电话长度不能超过 255 个字符")
	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}
	
	@Length(min=0, max=255, message="职务长度不能超过 255 个字符")
	public String getDuty() {
		return duty;
	}

	public void setDuty(String duty) {
		this.duty = duty;
	}
	
	public Integer getAccessPermission() {
		return accessPermission;
	}

	public void setAccessPermission(Integer accessPermission) {
		this.accessPermission = accessPermission;
	}
	
	@Length(min=0, max=255, message="人脸图片地址长度不能超过 255 个字符")
	public String getEmployeePhoto() {
		return employeePhoto;
	}

	public void setEmployeePhoto(String employeePhoto) {
		this.employeePhoto = employeePhoto;
	}
	
	public Integer getIsManager() {
		return isManager;
	}

	public void setIsManager(Integer isManager) {
		this.isManager = isManager;
	}
	
	@Length(min=0, max=255, message="健康证编号长度不能超过 255 个字符")
	public String getHealthNum() {
		return healthNum;
	}

	public void setHealthNum(String healthNum) {
		this.healthNum = healthNum;
	}
	
	@Length(min=0, max=255, message="健康证类别长度不能超过 255 个字符")
	public String getHealthType() {
		return healthType;
	}

	public void setHealthType(String healthType) {
		this.healthType = healthType;
	}
	public Employee getEmployee() {
		Employee employee = (Employee)getRefObj();
		if(employee == null) {
			employee = new Employee();
			setRefObj(employee);
		}

		return employee;
	}
	public void setEmployee(Employee employee) {
		setRefObj(employee);
	}
	
}